package com.sgb.kjwl.view.ui.adapter.transport;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;

import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.transport.FreightProEntity;
import com.sgb.kjwl.view.ui.adapter.map.BaseRecycleAdapter;
import com.sgb.kjwl.view.ui.adapter.map.ItemViewHolder;
import com.swgk.core.customview.WSTextView;

import java.util.List;

/**
 * Describe:
 * Author:  yangLei
 * Date:    2021/8/30
 */
public class SourcePopListAdapter extends BaseRecycleAdapter<FreightProEntity> {

    public SourcePopListAdapter(Context context, List<FreightProEntity> data) {
        super(context, R.layout.app_bidding_source_list_item_layout, data);
    }

    @Override
    public void convert(ItemViewHolder holder, FreightProEntity entity) {
        WSTextView name = holder.getItem().findViewById(R.id.pro_name);
        ImageView select_iv = holder.getItem().findViewById(R.id.select_iv);

        name.setText(entity.getCityName() + " " + entity.getDistrictName()
                + " -> " + entity.getDestCityName() + " " + entity.getDestDistrictName() + "货运项目");

        if (entity.isSelect()) {
            select_iv.setVisibility(View.VISIBLE);
            name.setBold(WSTextView.BOLD_MEDIUM);
            name.setTextColor(Color.parseColor("#000000"));
        } else {
            select_iv.setVisibility(View.GONE);
            name.setBold(WSTextView.BOLD_REGULAR);
            name.setTextColor(Color.parseColor("#333333"));
        }

    }
}
